home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000013_icon-group-sender _Tue Jan 7 14:01:06 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Tue, 7 Jan 1997 14:36:15 MST
Date: Tue, 7 Jan 1997 14:01:06 -0600
Message-Id: <199701072001.OAA06901@ns1.computek.net>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: gep2@computek.net
Subject: Another Question from the Neophyte -Reply
To: icon-group@cs.arizona.edu
X-Mailer: SPRY Mail Version: 04.00.06.17
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1522
>The question was how best to scan for the last nonblank token,
as I recall.
Well, I don't recall the problem being described in QUITE that way... if so, one
probably needs to consider things like nesting and embedded (e.g. in quoted
strings) commas or spaces... forcing characters and all the other minutae.
>Using reverse() seems the most natural way to do it, if no
preceding tokens are needed.
It actually works quite well, even IF preceding tokens are needed. You just get
them AFTER the "last" one, rather than before it.
>Otherwise, a normal left-to-right scan to put tokens on a list (tokenlist)
would be best.
I tend to avoid that kind of thing since I think it's rather contrary to the
spirit of ICON... rather more the way you'd do things in C (which isn't
necessarily BAD per se, but it means you're thinking about things in the
old-fashioned knit-one-perl-two paradigms).
> But I do wonder about the implementation of reverse(). If it is a
very efficient operation, I'm sure it's the best general solution. I am
unfamiliar with the Icon source, so I do not know if it moves a lot of data
around, or just resets some pointers and flags to give the appearance of
reversing a string.
It's a pretty safe guess that it actually creates an inverted copy of the
string. This ought to be done efficiently enough (especially when compared to
the OTHER functions your Icon code calls up!) that one needn't worry a great
deal about it.
Gordon Peterson
http://www.computek.net/public/gep2/